package hihocoder;
import java.util.Scanner;

public class FontSize {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int TASKS = scanner.nextInt();
		while (TASKS-- > 0) {
			int N = scanner.nextInt();
			int P = scanner.nextInt();
			int W = scanner.nextInt();
			int H = scanner.nextInt();
			int[] a = new int[N];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}
			int S = Math.min(W, H);
			int rolCount;
			int totalCount;
			do {
				int midLen = (W / S);
				int hightLen = (H / S);
				rolCount = 0;
				for (int i = 0; i < a.length; i++) {
					rolCount += Math.ceil((float)a[i] / midLen);//注意要转换成float才能准确
				}
				totalCount = P * hightLen;
				S--;
			} while (rolCount > totalCount);
			System.out.println(S + 1);
		}
	}
}
